package com.newblog.test;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
import java.util.LinkedList;
import java.util.List;

import com.newblog.factory.DB;
public class MetaData {
	private static final String ALL="SELECT * FROM nb_log";
	public static void main(String[] args) throws Exception{
	    Connection conn = 	DB.getConn();
	    Statement stmt = conn.createStatement();
	    ResultSet  rs  = stmt.executeQuery(ALL);
		ResultSetMetaData  rsmd  = rs.getMetaData();
		int counts = rsmd.getColumnCount();
		List l = new LinkedList();
		Types t = null;
		for(int i=1;i<counts;i++){
			t = new  Types(rsmd.getColumnTypeName(i),rsmd.getColumnName(i));
			l.add(t);
		}
		AutoRun.run(l);
		AutoRun.save();
	}

}
